import {
  legacy_createStore,
  combineReducers,
  applyMiddleware,
  compose,
} from "redux";
import * as reduxThunk from "redux-thunk";
import number from "./reducer/number";
import address from "./reducer/address";
const combineReducs = combineReducers({
  number,
  address,
});
console.log(reduxThunk);

//创建数据仓库
//window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() 为了让浏览器正常使用 redux-dev-tools 浏览器插件
//const store = legacy_createStore(reducres,window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__())
//__REDUX_DEVTOOLS_EXTENSION_COMPOSE__  让redux支持异步
//判断有没有__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ 这个模块
let composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
  ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({})
  : compose;
//把仓库数据，浏览器redux_dev_tools,reduxThunk插件关联store中。
const store = legacy_createStore(
  combineReducs,
  composeEnhancers(applyMiddleware(reduxThunk.thunk))
);

export default store;
